package com.leozhang.app;

import com.spire.xls.*;

public class IterateExcel {
    public static void main(String[] args) {
        // 加载 Excel 文件
        Workbook workbook = new Workbook();
        workbook.loadFromFile("Example.xlsx");

        // 获取第一个工作表
        Worksheet sheet = workbook.getWorksheets().get(0);

        // 遍历所有行和列
        for (int row = 1; row <= sheet.getLastRow(); row++) {
            for (int col = 1; col <= sheet.getLastColumn(); col++) {
                String cellValue = sheet.getCellRange(row, col).getText();
                System.out.print(cellValue + "\t");
            }
            System.out.println();
        }
    }
}

